home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac-Source 1994 July
/
Mac-Source_July_1994.iso
/
C and C++
/
Libraries
/
Stdio+
/
stdio+.h
< prev
next >
Wrap
Text File
|
1989-05-27
|
4KB
|
134 lines
/*
* stdio.h
*
* defines the structure used by the LightSpeedC I/O ("standard I/O")
* routines and some of the associated values and macros.
*
* (C) Copyright 1985, 1986. THINK Technologies Inc. All rights reserved.
*
* Added in fdopen() & fdreopen(), Nigel Perry, 1989
*/
#ifndef _stdioh_
#define _stdioh_
/* By uncommenting the next #define you are allowed to use the paste
menu item in the stdio menus. It allows the contents of the clipboard
to be pasted into the input stream. (see stdget_console.c for info)
HOWEVER, IT ADDS OVER 200 BYTES TO THE SIZE OF STDIO! */
/* #define _STD_PASTE_ */
#define BUFSIZ 512
#define BUFSIZE 512
#define NULL 0L
#define _NFILE 30 /* increased from 15 */
#define EOF (-1)
#define STDERRNO 2
#define stdin (&_file[0])
#define stdout (&_file[1])
#define stderr (&_file[STDERRNO])
#define _console (&_console_)
#define MAX(a, b) (a > b ? a : b)
#define MIN(a, b) (a < b ? a : b)
typedef struct {
int refnum; /* OS Reference number */
int last_error; /* holds last error on file */
int fileno; /* fnum for level 1 I/O */
unsigned user_buf:1, /* 1 if user defined buffer */
InUse:1, /* 0 if free */
StdStream:1, /* 0 = file, 1 = stdio */
rd:1,wr:1, /* flag for read and write */
look_full:1, /* flag for look_ahead */
mod:1, /* file modified flag */
binary:1, /* flag for binary file */
window:1; /* this is a window */
unsigned char look_ahead;/* char for look_ahead */
char *filebuf; /* Pointer to buffer */
int fpos; /* pos of file in buffer */
int inbuf; /* # of chars in buffer */
} FILE;
void clearerr(); /* clear last error that occured */
void clrerr(); /* clear last error that occured */
void cputs(); /* puts a string to the console (screen) */
void gotoxy(); /* goto x,y on screen */
void Init_stdio(); /* initalize stdio (automatically done */
void putch(); /* print a character to the console */
void rewind(); /* set pointer to beginning of a file */
void Set_Echo(); /* set I/O to echo or not (true=echo) */
void Set_Tab(); /* set the width of the tab stop */
void Click_On(); /* Sets the click_to_continue option of or off */
void Stdio_config(); /* font,size,face,mode */
char *cgets(); /* gets a string from the console (keyboard) */
char *fgets(); /* gets a string from an input stream */
char *gets(); /* gets a string from stdin */
FILE *fopen(); /* open a file */
FILE *fopenw(); /* open a file */
FILE *freopen(); /* open a file using the given stream */
FILE *fdopen(); /* open a file using volref/name pair */
FILE *fdreopen(); /* open a file using volref/name pair on the given stream */
extern FILE _file[_NFILE]; /* file descriptor array (internal) */
extern FILE _console_; /* device name for the console */
long ftell(); /* get position within file */
/* new for windowed printf-2-w.c */
char *Get_ScreenPtr();
void *Get_WindowPtr(); /* actually a WindowPtr -- this saves bringing in
the include for WindowMgr.h */
int _closeall(); /* close all open files */
extern int errno;
/* Default for these functions are int so they don't need to be declared
Boolean StdEvent(); -- this is fine since Booleans become ints
cprintf();
cscanf();
fclose();
feof();
ferror();
fflush();
fgetc();
fileno();
fprintf();
fputc();
fputs();
fread();
fseek();
fwrite();
getch();
getche();
getxpos();
getypos();
isupper();
islower();
kbhit();
- max() and min() are now defined as macros in <stdio.h>
puts();
printf();
sprintf();
toint();
tolower();
toupper();
ungetc();
vcprintf();
vfprintf();
vprintf();
vsprintf();
_tolower();
_toupper();
onexit();
*/
#define getc(stream) (fgetc(stream))
#define getchar() (fgetc(stdin))
#define putc(c,stream) (fputc(c,stream))
#define putchar(c) (fputc(c,stdout))
#endif